#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int* selfDividingNumbers(int left, int right, int* returnSize) {
    int* nums = (int*)malloc(sizeof(int) * (right - left + 1));;
    int i = 0;
    int k = 0;
    int n = 0;
    for (i = left; i <= right; i++) {
        k = i;
        while (k > 0) {
            if (k % 10 == 0)break;
            if (i % (k % 10) == 0) {
                k /= 10;
            }
            else break;
        }
        if (k == 0) {
            nums[n++] = i;
        }
    }
    *returnSize = n;
    return nums;
}
int main() {
    int left = 1000, right = 2000,num=0;
    int *p=selfDividingNumbers(left, right, &num);
    int i = 0;
    for (i = 0; i < num; i++) {
        printf("%d ", p[i]);
    }
    return 0;
}